{template 'common/header'} 
{php load()->func('tpl')}

{if $operation == 'display'}

<div class="main">
	<form method="post" class="form-horizontal" id="form1">
    <div class="panel panel-info">
        <div class="panel-heading">
        	问题管理列表
        </div>
        <div class="form-group" style="width: 200px; height: 20px; margin-top: 10px; margin-left: 20px;">
   	<a href="{php echo $this->createWebUrl('question', array('op' => 'add','wt_id' => $q['id']))}"><button type="button" class="btn btn-primary">添加问题</button></a>		
    <form method="post">
    <input type="text" class="form-control" id="found" name="found" placeholder="请输入问题分类" style="margin-left: 175px; margin-top: -33px;">
     <input type="hidden" name="token" value="{$_W['token']}" />
    <input type="hidden" name="departmentid" value="{$department_id['department_id']}"> 
    <input type="hidden" name="op" value="search">
    <input type="submit" name="submit" class="btn btn-primary" style="float: right; margin-top: -35px; margin-right: -234px;" value="搜索">
   </form>
      </div>

        <div class="panel panel-default"> 
		<table class="table table-hover">
			<thead class="navbar-inner">
			<tr class="warning">
				<th>ID</th>
				<th>所属部门</th>
				<th>类别</th>
				<th>问题选项</th>
				<th>更新时间</th>
				<th>操作</th>
			</tr>
			</thead>
			<tbody>
			{loop $question $q}
			<tr>
				<td>{$q['id']}</td>
				<td>{$q['department']}</td>
				<td>{$q['category']}</td>
				<td>{$q['question']}</td>
				<td class="text-center"></td> 
				
				<td><a href="{php echo $this->createWebUrl('question', array('op' => 'change','wt_id' => $q['id']))}" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="bottom" title="查看详情">修改</a><a href="{php echo $this->createWebUrl('question', array('op' => 'del','wt_id' => $q['id']))}"  class="btn btn-default btn-sm"  data-toggle="tooltip" data-placement="bottom" title="删除"><i class="fa fa-times"></i></a></td>
			</tr>
			{/loop}
			<tr>
				<td style="text-align:center;"></td>
				<td colspan="10">
				<a class="btn btn-danger pull-left" href="{php echo $this->createWebUrl('Questiondown',array('department_id' => $department_id['department_id']))}">导出数据</a>
				</td>
			</tr>
			</tbody>
		</table> 
		</div>
    <div style="height: 50px; margin-left: 30%;">{$pager}</div>
    </div>
	</form>

</div>

{elseif $operation == 'change'}

<div class="main">
	<form method="post" class="form-horizontal" >
    <div class="panel panel-info">
        <div class="panel-heading">
        	问题选项修改
        </div>
  <div style="margin-left: 30px; margin-top: 25px; margin-bottom: 30px; width: 95%;">
  <fieldset class="form-group">
    <label for="exampleSelect1">所属部门</label>
    <select class="form-control" id="department_id" name="department_id" value="">
    	{loop $department $d}
      <option value="{$d[id]}">{$d['department']}</option>
    	{/loop}
    </select>
  </fieldset>

  <fieldset class="form-group">
    <label for="exampleSelect1">类别</label>
    <select class="form-control" id="category_id" name="category_id" value="{$change[0]['category']}">
      {loop $category $c}
      <option value="{$c['id']}">{$c['category']}</option>
      {/loop}
    </select>
  </fieldset>
 

  <fieldset class="form-group">
    <label for="exampleInputEmail1">问题选项</label>
    <input type="text" class="form-control" id="question" placeholder="" name="question" value="{$question['question']}">
    </fieldset>
    <input type="submit" name="submit" class="btn btn-primary" value="确认修改"></button>
    <input type="hidden" name="token" value="{$_W['token']}" /> 
    <input type="hidden" name="id" value="{$question['id']}" />   
    </div>
     
    </div>
	</form>

</div>

{elseif $operation == 'add'}

<div class="main">
	<form method="post" class="form-horizontal" >
    <div class="panel panel-info">
        <div class="panel-heading">
        	问题选项添加
        </div>
  <div style="margin-left: 30px; margin-top: 25px; margin-bottom: 30px; width: 95%;">
  <fieldset class="form-group">
    <label for="exampleSelect1">所属部门</label>
    <select class="form-control" id="department_id" name="department_id" value="{$change['department']}">
    	{loop $department $d}
      <option value="{$d[id]}">{$d['department']}</option>
    	{/loop}
    </select>
  </fieldset>

  <fieldset class="form-group">
    <label for="exampleSelect1">类别</label>
    <select class="form-control" id="category_id" name="category_id">
      {loop $category $c}
      <option value="{$c['id']}">{$c['category']}</option>
      {/loop}
    </select>
  </fieldset>
 

  <fieldset class="form-group">
    <label for="exampleInputEmail1">问题选项</label>
    <input type="text" class="form-control" id="question" placeholder="" name="question" value="{$question['question']}">
    </fieldset>
    <input type="submit" name="submit" class="btn btn-primary" value="确认修改"></button>
    <input type="hidden" name="token" value="{$_W['token']}" /> 
    <input type="hidden" name="id" value="{$question['id']}" />   
    </div>
     
    </div>
	</form>

</div>

{elseif $operation == 'search'}
<div class="main">
  <form method="post" class="form-horizontal" id="form1">
    <div class="panel panel-info">
        <div class="panel-heading">
          问题管理列表
        </div>
        <div class="form-group" style="width: 200px; height: 20px; margin-top: 10px; margin-left: 20px;">
    <a href="{php echo $this->createWebUrl('question', array('op' => 'add','wt_id' => $q['id']))}"><button type="button" class="btn btn-primary">添加问题</button></a>    
    <form method="post">
    <input type="text" class="form-control" id="found" name="found" placeholder="请输入问题分类" style="margin-left: 175px; margin-top: -33px;">
     <input type="hidden" name="token" value="{$_W['token']}" />
    <input type="hidden" name="departmentid" value="{$department_id['department_id']}"> 
    <input type="hidden" name="op" value="search">
    <input type="submit" name="submit" class="btn btn-primary" style="float: right; margin-top: -35px; margin-right: -234px;" value="搜索">
   </form>
      </div>

        <div class="panel panel-default"> 
    <table class="table table-hover">
      <thead class="navbar-inner">
      <tr class="warning">
        <th>ID</th>
        <th>所属部门</th>
        <th>类别</th>
        <th>问题选项</th>
        <th>更新时间</th>
        <th>操作</th>
      </tr>
      </thead>
      <tbody>
      {loop $question $q}
      <tr>
        <td>{$q['id']}</td>
        <td>{$q['department']}</td>
        <td>{$q['category']}</td>
        <td>{$q['question']}</td>
        <td class="text-center"></td> 
        
        <td><a href="{php echo $this->createWebUrl('question', array('op' => 'change','wt_id' => $q['id']))}" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="bottom" title="查看详情">修改</a><a href="{php echo $this->createWebUrl('question', array('op' => 'del','wt_id' => $q['id']))}"  class="btn btn-default btn-sm"  data-toggle="tooltip" data-placement="bottom" title="删除"><i class="fa fa-times"></i></a></td>
      </tr>
      {/loop}
      
      </tbody>
    </table> 
    </div>
    </div>
  </form>
{$pager}
</div>
{/if}
{template 'common/footer'}